package cn.kgc.lambda;

/**
 * @author: mosin
 * @version: v1.0  2022/10/20
 * lambda表达式 实现方法的引用  ::
 */
public class LambdaDemo02 {


    public static void main(String[] args) {

        LambdaInterface5 lambdaInterface5 = a -> a+10;
        //LambdaInterface5 lambdaInterface6 = a -> a+10;
        //LambdaInterface5 lambdaInterface7 = a -> a+10;

        //LambdaInterface5 lambdaInterface8 = a -> add(a);

        // 方法的引用
        //LambdaInterface5 lambdaInterface8 = LambdaDemo02::add;

        LambdaDemo02 lambdaDemo02 = new LambdaDemo02();

        LambdaInterface5 lambdaInterface8 = lambdaDemo02::add2;

        int res = lambdaInterface8.method(5);
        System.out.println("res = " + res);
    }

    public  static  int add(int a){
        return a+10;
    }


    public  int add2(int a){
        return a+20;
    }

}
